package ChartType;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;

public class Utils {
    public String getName() {
        try {
            DocumentBuilderFactory dBuilderFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = dBuilderFactory.newDocumentBuilder();
            Document doc = builder.parse(new File("resource/config.xml"));
            NodeList nodeList = doc.getElementsByTagName("chartTyoe");
            Node nodeName = nodeList.item(0).getFirstChild();
            return nodeName.getNodeValue().trim();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
